<table id="chiTiet">
<?php
	if(!isset($_GET["id"]))
		myLib::RedirectToURL("index.php?act=1");
	
	$id = $_GET["id"];
	
	//Lay so luoc xem cua xe co id tuong ung
	$sql = "SELECT * FROM dt WHERE madt = ".$id;
	$result = DataProvider::ExecuteQuery($sql);
	$row = mysql_fetch_array($result);
	
	$soluong = $row["soluongban"];
	
	//Cap nhat lai so luoc xe trong CDSL
	$sql = "UPDATE dt SET soluongban = ".$soluong." WHERE madt = ".$id;
	DataProvider::ExecuteQuery($sql);
?>	
	<tr>
		<td rowspan="3" width="200">
				<img src="<?php echo $row ["hinh"];?>"  width="150" />
		</td>
		<td>
				<font size="+3"><b/><?php echo $row["tendt"]?></font>
		</td>
	</tr>
    <tr>
		<td>
				<b/>Giá bán: <font color="#FF0000"><?php echo number_format ($row["gia"]); ?>&nbsp;vnd</font>
		</td>
	</tr>
	<tr>
		<td align="left">
				<b>Tính năng:</b> <?php echo $row["thongtinchitiet"] ?>
  		</td>
	</tr>
    <?php
		if(isset($_SESSION["manguoidung"]))
		{
			?>
   				<tr> 
                    <td>
                        <b>Số lượng: </b>
                        <select id="cmbSoLuong">
                            <option value="1">1</option>
                            <option value="2">2</option>
                            <option value="3">3</option>
                            <option value="4">4</option>
                            <option value="5">5</option>
                        </select>
                    </td>
               </tr>
               <tr align="center">
                    <td>
                        <img src="images/Layout/gio hang.png" onclick="ThemVoGioHang()">
                    </td>
               </tr>  
               <script type="text/javascript">
               		function ThemVoGioHang()
					{
						var id = <?php echo $id; ?>;
						var soluong = document.getElementById("cmbSoLuong").value;
						
						location.href = "./pages/xlThemGioHang.php?id="+id+"&sl="+soluong;
					}
               </script>       
            <?php		
		}
		else
		{
			?>
                <tr>
                    <td><i>Cần phải đăng nhập để sử dụng chức năng đặt hàng online</i></td>
                </tr>               
            <?php	
		}
	?>

</table>
<h2>Sản phẩm cùng loại</h2>
<table>
	<tr>
    	<?php
			$sql = "select * from dt where manhasanxuat = ".$row["manhasanxuat"]." and madt != ".$row["madt"]." limit 0,3";
			$result = DataProvider::ExecuteQuery($sql);
			while($row = mysql_fetch_array($result)){
				echo "<td>";
				include("pages/tempDT.php");
				echo "</td>";
			}
		?>
    </tr>
</table>